from django.core.mail import send_mail
from django.db import models

from rubbish.models import *

def send_status():
    context={}
    context['Recyclable']=(Recyclable.objects.latest("created"))
    context['Residual']=(Residual.objects.latest("created"))
    context['Hazardous']=(Hazardous.objects.latest("created"))
    context['Food']=(Food.objects.latest("created"))
    for v in context.values():
        if v.data <30:
            send_mail("垃圾桶状态提醒","您所管理的垃圾桶剩余量不足，请查看状态及时清理\n","2660245132@qq.com",["2660245132@qq.com"])
            break


